home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 43.zip / Sources C - WorkDisk IV.adf / v.c < prev    next >
C/C++ Source or Header  |  1987-02-15  |  7KB  |  344 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3.  
  4. struct IntuitionBase *IntuitionBase;
  5. struct GfxBase *GfxBase;
  6. struct LayersBase *LayersBase;
  7. struct Screen *CustScr;
  8. struct BitMap BitMap;
  9. struct Window *Wdw;
  10. struct ViewPort *WVP;
  11. struct IntuiMessage *message;
  12. ULONG class;
  13.  
  14. #define Rp   Wdw->RPort
  15. #define BLACK 0x000
  16. #define BGRP    0
  17. #define MODBLU 0x10
  18. #define MODRED 0x20
  19. #define MODGRN 0x30
  20. #define RON 0x555
  21. #define JOHN 0x820
  22. struct NewScreen NewCustScr =
  23.                  {
  24. 0,0,
  25. 320,200,6,
  26. 1,0,
  27. HAM,
  28. CUSTOMSCREEN,
  29. NULL,
  30. NULL,
  31. NULL,
  32. NULL,
  33. };
  34.  
  35. struct NewWindow NewWdw =
  36. {
  37. 0,0,
  38. 320,200,
  39. NULL,NULL,
  40. VANILLAKEY,
  41. VANILLAKEY + SUPER_BITMAP + ACTIVATE + SMART_REFRESH
  42.  + BORDERLESS,
  43. NULL,
  44. NULL,
  45. NULL,
  46. NULL,
  47. NULL,
  48. 0,0,
  49. 0,0,
  50. CUSTOMSCREEN
  51. };
  52.  
  53. main()
  54. {
  55. int x;
  56.  
  57. IntuitionBase = (struct IntuitionBase *)
  58. OpenLibrary("intuition.library",LIBRARY_VERSION);
  59. if (IntuitionBase == NULL) exit(100);
  60.  
  61. GfxBase = (struct GfxBase *)
  62. OpenLibrary("graphics.library",LIBRARY_VERSION);
  63. if (GfxBase == NULL) exit(200);
  64.  
  65. LayersBase = (struct LayersBase *)
  66. OpenLibrary("layers.library",LIBRARY_VERSION);
  67. if (LayersBase == NULL) exit(300);
  68.  
  69.  
  70. if ((NewWdw.Screen = CustScr =
  71. (struct Screen *)OpenScreen(&NewCustScr)) == NULL)
  72.     exit(400);
  73.  
  74. if ((Wdw = (struct Window *)OpenWindow(&NewWdw)) == NULL)
  75.     exit(500);
  76.  
  77. InitBitMap(&BitMap,2,3840,20);
  78.  
  79. for (x=0;x<2;x++)
  80. if
  81. ((BitMap.Planes[x] = (PLANEPTR)AllocRaster(7880,20)) ==0)
  82. exit(600);
  83. else BltClear (BitMap.Planes[x],3658,0);
  84.  
  85. NewWdw.BitMap = (struct BitMap *)&BitMap;
  86.  
  87. if (( Wdw = (struct Window *)OpenWindow(&NewWdw)) ==0)
  88. exit(700);
  89.  
  90. WVP = (struct ViewPort *)ViewPortAddress(Wdw);
  91. SetRGB4(WVP,0,0,0,0);
  92. SetRGB4(WVP,1,4,4,4);
  93. SetRGB4(WVP,2,5,5,5);
  94. SetRGB4(WVP,3,6,6,6);
  95. SetRGB4(WVP,4,7,7,7);
  96. SetRGB4(WVP,5,8,8,8);
  97. SetRGB4(WVP,6,9,9,9);
  98. SetRGB4(WVP,7,10,10,10);
  99. SetRGB4(WVP,8,11,11,11);
  100. SetRGB4(WVP,9,12,12,12);
  101. SetRGB4(WVP,10,13,13,13);
  102. SetRGB4(WVP,11,14,14,14);
  103. SetRGB4(WVP,12,15,15,15);
  104. demo();
  105.  
  106. Wait(1<<Wdw->UserPort->mp_SigBit);
  107.  
  108. for (x=0;x<2;x++)
  109. if (BitMap.Planes[x] |= 0)
  110. FreeRaster(BitMap.Planes[x],3840,25);
  111.  
  112. CloseWindow(Wdw);
  113. CloseScreen(CustScr);
  114. CloseLibrary(GfxBase);
  115. CloseLibrary(IntuitionBase);
  116. CloseLibrary(LayersBase);
  117.  
  118. }
  119.  
  120. demo()
  121.  
  122. {
  123. int line;
  124. int c,d,e;
  125.  
  126. SetAPen(Rp,BLACK);
  127. RectFill(Rp,0,0,320,29);
  128. SetAPen(Rp,1);
  129. RectFill(Rp,0,30,320,32);
  130. SetAPen(Rp,2);
  131. RectFill(Rp,0,32,320,34);
  132. SetAPen(Rp,3);
  133. RectFill(Rp,0,34,320,36);
  134. SetAPen(Rp,4);
  135. RectFill(Rp,0,36,320,38);
  136. SetAPen(Rp,5);
  137. RectFill(Rp,0,38,320,40);
  138. SetAPen(Rp,6);
  139. RectFill(Rp,0,40,320,42);
  140. SetAPen(Rp,7);
  141. RectFill(Rp,0,42,320,44);
  142. SetAPen(Rp,8);
  143. RectFill(Rp,0,44,320,46);
  144. SetAPen(Rp,9);
  145. RectFill(Rp,0,46,320,48);
  146. SetAPen(Rp,10);
  147. RectFill(Rp,0,48,320,50);
  148. SetAPen(Rp,11);
  149. RectFill(Rp,0,50,320,52);
  150. SetAPen(Rp,12);
  151. RectFill(Rp,0,52,320,54);
  152. SetAPen(Rp,11);
  153. RectFill(Rp,0,54,320,56);
  154. SetAPen(Rp,10);
  155. RectFill(Rp,0,56,320,58);
  156. SetAPen(Rp,9);
  157. RectFill(Rp,0,58,320,60);
  158. SetAPen(Rp,8);
  159. RectFill(Rp,0,60,320,62);
  160. SetAPen(Rp,7);
  161. RectFill(Rp,0,62,320,64);
  162. SetAPen(Rp,6);
  163. RectFill(Rp,0,64,320,66);
  164. SetAPen(Rp,5);
  165. RectFill(Rp,0,66,320,68);
  166. SetAPen(Rp,4);
  167. RectFill(Rp,0,68,320,70);
  168. SetAPen(Rp,3);
  169. RectFill(Rp,0,70,320,72);
  170. SetAPen(Rp,2);
  171. RectFill(Rp,0,72,320,74);
  172. SetAPen(Rp,1);
  173. RectFill(Rp,0,74,320,76);
  174.  
  175. SetAPen(Rp,MODBLU+2);
  176. RectFill(Rp,0,90,320,92);
  177. SetAPen(Rp,MODBLU+3);
  178. RectFill(Rp,0,92,320,94);
  179. SetAPen(Rp,MODBLU+4);
  180. RectFill(Rp,0,94,320,96);
  181. SetAPen(Rp,MODBLU+5);
  182. RectFill(Rp,0,96,320,98);
  183. SetAPen(Rp,MODBLU+6);
  184. RectFill(Rp,0,98,320,100);
  185. SetAPen(Rp,MODBLU+7);
  186. RectFill(Rp,0,100,320,102);
  187. SetAPen(Rp,MODBLU+8);
  188. RectFill(Rp,0,102,320,104);
  189. SetAPen(Rp,MODBLU+9);
  190. RectFill(Rp,0,104,320,106);
  191. SetAPen(Rp,MODBLU+10);
  192. RectFill(Rp,0,106,320,108);
  193. SetAPen(Rp,MODBLU+11);
  194. RectFill(Rp,0,108,320,110);
  195. SetAPen(Rp,MODBLU+12);
  196. RectFill(Rp,0,110,320,112);
  197. SetAPen(Rp,MODBLU+13);
  198. RectFill(Rp,0,112,320,114);
  199. SetAPen(Rp,MODBLU+12);
  200. RectFill(Rp,0,114,320,116);
  201. SetAPen(Rp,MODBLU+11);
  202. RectFill(Rp,0,116,320,118);
  203. SetAPen(Rp,MODBLU+10);
  204. RectFill(Rp,0,118,320,120);
  205. SetAPen(Rp,MODBLU+9);
  206. RectFill(Rp,0,120,320,122);
  207. SetAPen(Rp,MODBLU+8);
  208. RectFill(Rp,0,122,320,124);
  209. SetAPen(Rp,MODBLU+7);
  210. RectFill(Rp,0,124,320,126);
  211. SetAPen(Rp,MODBLU+6);
  212. RectFill(Rp,0,126,320,128);
  213. SetAPen(Rp,MODBLU+5);
  214. RectFill(Rp,0,128,320,130);
  215. SetAPen(Rp,MODBLU+4);
  216. RectFill(Rp,0,130,320,132);
  217. SetAPen(Rp,MODBLU+3);
  218. RectFill(Rp,0,132,320,134);
  219. SetAPen(Rp,MODBLU+2);
  220. RectFill(Rp,0,134,320,136);
  221.  
  222. SetAPen(Rp,1);
  223. RectFill(0,150,320,152);
  224. SetAPen(Rp,2);
  225. RectFill(0,152,320,154);
  226. SetAPen(Rp,3);
  227. RectFill(0,154,320,156);
  228. SetAPen(Rp,4);
  229. RectFill(0,156,320,158);
  230. SetAPen(Rp,5);
  231. RectFill(0,158,320,160);
  232. SetAPen(Rp,6);
  233. RectFill(0,160,320,162);
  234. SetAPen(Rp,7);
  235. RectFill(0,162,320,164);
  236. SetAPen(Rp,8);
  237. RectFill(Rp,0,164,320,166);
  238. SetAPen(Rp,9);
  239. RectFill(Rp,0,166,320,168);
  240. SetAPen(Rp,10);
  241. RectFill(Rp,0,168,320,170);
  242. SetAPen(Rp,11);
  243. RectFill(Rp,0,170,320,172);
  244. SetAPen(Rp,12);
  245. RectFill(Rp,0,172,320,174);
  246. SetAPen(Rp,13);
  247. RectFill(Rp,0,174,320,176);
  248. SetAPen(Rp,12);
  249. RectFill(Rp,0,176,320,178);
  250. SetAPen(Rp,11);
  251. RectFill(Rp,0,178,320,180);
  252. SetAPen(Rp,10);
  253. RectFill(Rp,0,180,320,182);
  254. SetAPen(Rp,9);
  255. RectFill(Rp,0,182,320,184);
  256. SetAPen(Rp,8);
  257. RectFill(Rp,0,184,320,186);
  258. SetAPen(Rp,7);
  259. RectFill(Rp,0,186,320,188);
  260. SetAPen(Rp,6);
  261. RectFill(Rp,0,188,320,190);
  262. SetAPen(Rp,5);
  263. RectFill(Rp,0,190,320,192);
  264. SetAPen(Rp,4);
  265. RectFill(Rp,0,192,320,194);
  266. SetAPen(Rp,3);
  267. RectFill(Rp,0,194,320,196);
  268. SetAPen(Rp,2);
  269. RectFill(Rp,0,196,320,198);
  270. SetAPen(Rp,1);
  271. RectFill(Rp,0,198,320,199);
  272.  
  273. SetAPen(Rp,BLACK);
  274. RectFill(Rp,0,0,320,29);
  275.  
  276. for (c=0;c<9;c++)
  277. {
  278. SetAPen(Rp,1+c);
  279. Move(Rp,56,77);
  280. Text(Rp,"ELECTRONIC DESIGN PRESENTS",26);
  281. Delay(4);
  282. }
  283.  
  284. for (d=0;d<16;d++)
  285. {
  286. SetSoftStyle(Rp, FSF_ITALIC, 255);
  287. SetAPen(Rp,MODBLU+d);
  288. Move(Rp,116,138);
  289. Text(Rp,"KARATE KING",11);
  290. Delay(4);
  291. }
  292.  
  293.  
  294. SetAPen(Rp,RON);
  295. Move(Rp,320,15);
  296.  
  297. Text(Rp,"This is our fir",15);
  298. Text(Rp,"st Intro writte",15);
  299. Text(Rp,"n in C. We are ",15);
  300. Text(Rp,"a Group of 4. 3",15);
  301. Text(Rp," boys are comin",15);
  302. Text(Rp,"g from Germany ",15);
  303. Text(Rp,"and 1 boy comes",15);
  304. Text(Rp," from Holland. ",15);
  305. Text(Rp," Hello George!!",15);
  306. Text(Rp," What do you th",15);
  307. Text(Rp,"ink about this?",15);
  308. Text(Rp," And here are t",15);
  309. Text(Rp,"he greetings: T",15);
  310. Text(Rp,"om, SCS, Movers",15);
  311. Text(Rp,", The New Age, ",15);
  312. Text(Rp,"E.C.A, S.S.I an",15);
  313. Text(Rp,"d The Star Fron",15);
  314. Text(Rp,"tiers.         ",15);
  315. Text(Rp,"PRESS SPACE ...",15);
  316. Text(Rp,".......        ",15);
  317. Text(Rp,"               ",15);
  318. Text(Rp,"               ",15);
  319.  
  320. Scroll (1,0);
  321. }
  322.  
  323. Scroll (x,y)
  324. int x,y;
  325. {
  326. int line;
  327. int f,g,h,i;
  328. for (line = 0; line < 3840; line++)
  329. {
  330. while(message=GetMsg(Wdw->UserPort))
  331. class=message->Class;
  332. if(class==VANILLAKEY) goto ScrollReady;
  333. ScrollLayer (0, Wdw->WLayer, x,y);
  334. WaitTOF();
  335. }
  336. ScrollReady:
  337. CloseWindow(Wdw);
  338. CloseScreen(CustScr);
  339. CloseLibrary(GfxBase);
  340. CloseLibrary(LayersBase);
  341. Exit (TRUE);
  342. }
  343.  
  344.